package com.example.springboot_sp.mapper;

import com.example.springboot_sp.entity.Article;
import com.example.springboot_sp.entity.Type;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 郭守军
 * @since 2022-09-08
 */
public interface TypeMapper extends BaseMapper<Type> {
    @Select("select a.*  from article a left join type t on t.id = a.typeid where t.name = #{name}")
    List<Article> findALLInforOfArticleByTypeName(@Param("name")  String name);

    @Select("select a.*  from article a left join type t on t.name = a.type where t.name = #{name} limit 3")
    List<Article> findALLInforOfArticleByTypeNameLimit(@Param("name")  String name);
}
